﻿using System;
using Microsoft.Practices.EnterpriseLibrary.Validation;
using Microsoft.Practices.EnterpriseLibrary.Validation.Validators;

namespace WebPattern.Core.Validators.Attributes
{
    public class MaxMinLengthAttribute : ValueValidatorAttribute
    {
        public int UpperBound { get; private set; }

        public MaxMinLengthAttribute(int upperBound)
        {
            this.UpperBound = upperBound;
        }

        protected override Validator DoCreateValidator(Type targetType) {
            return new MaxMinLengthValidator(UpperBound);
        }
    }
}
